import request from '../../request'
import { AxiosResponse } from 'axios'
import { ResponseData } from '@/types/api/public'

type ConfigType<T=ResponseData> = Promise<AxiosResponse<T>>

/**
 * @desc: 获取
 */
export const getequipmentTypes = (): ConfigType => {
  return request({
    url: `/peng/getequipmentTypes`,
    method: 'get',
  })
}
export const getequipmentType = (name:String,page:Number,size:Number): ConfigType => {
  return request({
    url: `/peng/getequipmentType?name=${name}&page=${page}&size=${size}`,
    method: 'get',
  })
}

/**
 * @desc: 添加
 */
export const postequipmentType = (data:any): ConfigType => {
    console.log(data);
    return request({
      url: '/peng/postequipmentType',
      method: 'post',
      data
    })
  }

/**
 * @desc: 删除
 */
 export const delequipmentType = (id:any): ConfigType => {
  return request({
    url: '/peng/delequipmentType?_id='+id,
    method: 'get'
  })
}

/**
 * @desc: 修改
 */
export const putequipmentType = (data:any): ConfigType => {
  console.log(data);
  return request({
    url: '/peng/putequipmentType',
    method: 'post',
    data
  })
}

/**
 * @desc: 获取
 */
export const getequipment = (name:String,page:Number,size:Number): ConfigType => {
  return request({
    url: `/peng/getequipment?_id=${name}&page=${page}&size=${size}`,
    method: 'get',
  })
}

/**
 * @desc: 添加
 */
export const postequipment = (data:any): ConfigType => {
  console.log(data);
  return request({
    url: '/peng/postequipment',
    method: 'post',
    data
  })
}

/**
 * @desc: 删除
 */
export const delequipment = (id:any): ConfigType => {
  return request({
    url: '/peng/delequipment?_id='+id,
    method: 'get'
  })
}

/**
 * @desc: 修改
 */
export const putequipment = (data:any): ConfigType => {
  console.log(data);
  return request({
    url: '/peng/putequipment',
    method: 'post',
    data
  })
}
export const putequipmentstr = (data:any,list:any): ConfigType => {
  console.log(data);
  return request({
    url: '/peng/putequipmentstr',
    method: 'post',
    data:{data,list}
  })
}

/**
 * @desc: 修改策略
 */
export const setstraa = (data:any): ConfigType => {
  console.log(data);
  return request({
    url: '/peng/setstra?_id='+data,
    method: 'get',
  })
}

/**
 * @desc: 获取策略
 */
export const getstrategys = (): ConfigType => {
  return request({
    url: '/peng/getstrategys',
    method: 'get',
  })
}